home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.develop.bsis.com!usenet
- From: Leonard Lehew <leonard.lehew@bsis.com>
- Newsgroups: comp.lang.smalltalk,comp.object,comp.lang.c++,comp.lang.java
- Subject: Re: The Good, the Bad, the Ugly, and the Wicked ...
- Date: Wed, 27 Mar 1996 16:32:21 -0500
- Organization: Broadway and Seymour
- Message-ID: <3159B3E5.5281@bsis.com>
- References: <31570B8E.5A12@vmark.com> <31586721.1750@mobius.net> <4jbk0m$jt9@news4.digex.net> <AD7EDB45966858C12@mac-sandvik.engr.sgi.com>
- NNTP-Posting-Host: bsi16_83.bsis.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Kent Sandvik wrote:
- >
- > In article <4jbk0m$jt9@news4.digex.net>,
- > ell@access1.digex.net (Ell) wrote:
- >
- > >racer-x (pauly@mobius.net) wrote:
- > >: ...Maybe it's just me, but I didn't even realize C++ had
- > >: dynamic binding.
- > >
- > >Guess what? It is you. :-)
- > >
- > >C++ very much has dynamic binding; lookup virtual functions.
- >
- > It depends how you defined dynamic binding, could you send messages to
- > arbitrary methods in C++ during runtime (or java, by the way)?
- >
- > --Kent
- >
- > Kent Sandvik, Silicon Graphics, Inc. Member of Technical Staff
- > Email: sandvik@sgi.com Phone: +1 415 933-6417
- > http://reality.sgi.com/sandvik/ (sgi http:/kent.engr/)
- > "May all developers be happy."It all depends on how you define dynamic binding.
-
- C++ implements dynamic binding through virtual methods. When a virtual
- member function is invoked (i.e., when a message is sent to an object)
- the actual run time object must be of the class the compiler "expects" or
- it must be of a class derived from the "expected" class. This means
- that the polymorphism only extends to classes which are part of the
- same inheritance tree.
-
- Smalltalk by comparison does not impose this restriction. You can send
- any message selector to any object at runtime. If the receiving object
- has a corresponding method, it will be invoked, regardless of its
- inheritance.
-
- Which is better depends on your perspective and needs. The strong type
- checking in C++ detects certain errors before testing, and C++ apps
- generally perform better. On the other hand, there are many circumstances
- where I want polymorphic behavior, and inheritance is just not the most
- natural, convenient, or elegant way to achieve it.
-
-
- Leonard Lehew
- Broadway & Seymour
-